<?php
define('NO_CHECK_LOGIN','turn');
require 'init.php';
if($_POST){
	$username=Username(I('username','post','html','未输入'));
	$usernumber=Usernumber(I('usernumber','post','html','未输入'));
	$userpassword1=Userpassword(I('userpassword1','post','html','未输入'));
	$userpassword2=Userpassword(I('userpassword2','post','html','未输入'));
	if($userpassword1===$userpassword2){
		$userpassword=$userpassword1;
	}else{
		echo "密码确认失败";
		exit();
	}
	$userdata=[
		'username'=>$username,
		'usernumber'=>$usernumber,
		'userpassword'=>$userpassword
	];
	if($username!=''&&$usernumber!=''&&$userpassword!=''){
		mysqli_query($link,"INSERT INTO usertable (`username`,`usernumber`,`userpassword`) VALUES('$username','$usernumber', '$userpassword')");
		@mysql_close($link);
        echo "<script>alert ('注册成功，跳转至登录页');</script>";
		redirect('../view/login.html');
	}else{
		echo "<script>alert ('注册失败重新注册');</script>";
		redirect('../view/signup.html');
		exit();
	}
}
require '../view/signup.html';
?>